<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
    xmlns:s="http://jboss.com/products/seam/taglib"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:a="http://richfaces.org/a4j"
    xmlns:rich="http://richfaces.org/rich"
    template="layout/template.xhtml">

<ui:define name="body">
    <h:form id="firma" styleClass="edit">

        <rich:panel headerClass="outpanelHeader">
            <f:facet name="header">#{firmaHome.managed ? 'Edit' : 'Add'} Firma</f:facet>

			<rich:layout>
 
              	<rich:layoutPanel position="left">
		            <s:decorate id="kodField" template="layout/edit.xhtml">
		                <ui:define name="label">Kod</ui:define>
		                <h:inputText id="kod" cols="80" rows="3" required="true" value="#{firmaHome.instance.kod}"/>
		            </s:decorate>
		
		            <s:decorate id="adField" template="layout/edit.xhtml">
		                <ui:define name="label">Ad</ui:define>
		                <h:inputText   id="ad" cols="80" rows="10" required="true" value="#{firmaHome.instance.ad}"/>
		            </s:decorate>
		
		            <s:decorate id="telefonField" template="layout/edit.xhtml">
		                <ui:define name="label">Telefon</ui:define>
		                <h:inputText id="telefon" size="13" maxlength="13" value="#{firmaHome.instance.telefon}">
		                    <a:support event="onblur" reRender="telefonField" bypassUpdates="true" ajaxSingle="true"/>
		                </h:inputText>
		            </s:decorate>
				            
		            <s:decorate id="adresField" template="layout/edit.xhtml">
		                <ui:define name="label">Adres</ui:define>
		                <h:inputTextarea id="adres" cols="80" rows="10" value="#{firmaHome.instance.adres}"/>
		            </s:decorate>
				</rich:layoutPanel>
		        
				<rich:layoutPanel position="center">
		            <s:decorate id="epostaField" template="layout/edit.xhtml">
		                <ui:define name="label">Eposta</ui:define>
		                <h:inputText id="eposta" size="100" maxlength="100" value="#{firmaHome.instance.eposta}">
		                    <a:support event="onblur" reRender="epostaField" bypassUpdates="true" ajaxSingle="true"/>
		                </h:inputText>
		            </s:decorate>		

		            <s:decorate id="webadresiField" template="layout/edit.xhtml">
		                <ui:define name="label">Webadresi</ui:define>
		                <h:inputText id="webadresi" size="100" maxlength="100" value="#{firmaHome.instance.webadresi}">
		                    <a:support event="onblur" reRender="webadresiField" bypassUpdates="true" ajaxSingle="true"/>
		                </h:inputText>
		            </s:decorate>
		        
		            <s:decorate id="verginoField" template="layout/edit.xhtml">
		                <ui:define name="label">Vergino</ui:define>
		                <h:inputText id="vergino" value="#{firmaHome.instance.vergino}">
		                    <a:support event="onblur" reRender="verginoField" bypassUpdates="true" ajaxSingle="true"/>
		                </h:inputText>
		            </s:decorate>		
		            
		            <s:decorate id="mersisnoField" template="layout/edit.xhtml">
		                <ui:define name="label">Mersisno</ui:define>
		                <h:inputText id="mersisno" value="#{firmaHome.instance.mersisno}">
		                    <a:support event="onblur" reRender="mersisnoField" bypassUpdates="true" ajaxSingle="true"/>
		                </h:inputText>
		            </s:decorate>
				</rich:layoutPanel>
				
		    </rich:layout>  		        
		    


            <div style="clear:both">
                <span class="required">*</span>
                required fields
            </div>

        </rich:panel>

        <div class="actionButtons">

            <h:commandButton id="save"
                          value="Save"
                         action="#{firmaHome.persist}"
                       disabled="#{!firmaHome.wired}"
                       rendered="#{!firmaHome.managed}"/>

            <h:commandButton id="update"
                          value="Save"
                         action="#{firmaHome.update}"
                       rendered="#{firmaHome.managed}"/>

            <h:commandButton id="delete"
                          value="Delete"
                         action="#{firmaHome.remove}"
                      immediate="true"
                       rendered="#{firmaHome.managed}"/>

            <s:button id="cancelEdit"
                   value="Cancel"
             propagation="end"
                    view="/Firma.xhtml"
                rendered="#{firmaHome.managed}"/>

            <s:button id="cancelAdd"
                   value="Cancel"
             propagation="end"
                    view="/#{empty firmaFrom ? 'FirmaList' : firmaFrom}.xhtml"
                rendered="#{!firmaHome.managed}"/>

        </div>
    </h:form>

<rich:tabPanel switchType="ajax">

    <rich:tab label="Isemirs">
        <h:form styleClass="association" id="isemirsChildren">

            <h:outputText value="There are no isemirs associated with this firma."
                       rendered="#{empty firmaHome.isemirs}"/>

            <rich:dataTable value="#{firmaHome.isemirs}"
                           var="_isemir"
                      rendered="#{not empty firmaHome.isemirs}"
                    rowClasses="rvgRowOne,rvgRowTwo"
                            id="isemirsTable">
                <rich:column sortBy="#{_isemir.id}">
                    <f:facet name="header">Id</f:facet>
                    <h:outputText value="#{_isemir.id}"/>
                </rich:column>
                <rich:column sortBy="#{_isemir.aypaciklama}">
                    <f:facet name="header">Aypaciklama</f:facet>
                    <h:outputText value="#{_isemir.aypaciklama}"/>
                </rich:column>
                <rich:column sortBy="#{_isemir.formno}">
                    <f:facet name="header">Formno</f:facet>
                    <h:outputText value="#{_isemir.formno}"/>
                </rich:column>
                <rich:column sortBy="#{_isemir.isemirno}">
                    <f:facet name="header">Isemirno</f:facet>
                    <h:outputText value="#{_isemir.isemirno}"/>
                </rich:column>
                <rich:column sortBy="#{_isemir.isemirtarihi}">
                    <f:facet name="header">Isemirtarihi</f:facet>
                    <h:outputText value="#{_isemir.isemirtarihi}">
                        <s:convertDateTime type="date" dateStyle="short"/>
                    </h:outputText>
                </rich:column>
                <rich:column sortBy="#{_isemir.kalipeki}">
                    <f:facet name="header">Kalipeki</f:facet>
                    <h:outputText value="#{_isemir.kalipeki}"/>
                </rich:column>
                <rich:column sortBy="#{_isemir.musterimarkalamasi}">
                    <f:facet name="header">Musterimarkalamasi</f:facet>
                    <h:outputText value="#{_isemir.musterimarkalamasi}"/>
                </rich:column>
                <rich:column sortBy="#{_isemir.planlananadet}">
                    <f:facet name="header">Planlananadet</f:facet>
                    <h:outputText value="#{_isemir.planlananadet}"/>
                </rich:column>
                <rich:column sortBy="#{_isemir.siparisno}">
                    <f:facet name="header">Siparisno</f:facet>
                    <h:outputText value="#{_isemir.siparisno}"/>
                </rich:column>
                <rich:column sortBy="#{_isemir.termintarihi}">
                    <f:facet name="header">Termintarihi</f:facet>
                    <h:outputText value="#{_isemir.termintarihi}">
                        <s:convertDateTime type="date" dateStyle="short"/>
                    </h:outputText>
                </rich:column>
                <rich:column sortBy="#{_isemir.upkaciklama}">
                    <f:facet name="header">Upkaciklama</f:facet>
                    <h:outputText value="#{_isemir.upkaciklama}"/>
                </rich:column>
                <rich:column sortBy="#{_isemir.uretimenotlar}">
                    <f:facet name="header">Uretimenotlar</f:facet>
                    <h:outputText value="#{_isemir.uretimenotlar}"/>
                </rich:column>
            </rich:dataTable>

        </h:form>

        <f:subview rendered="#{firmaHome.managed}" id="isemirs">
        <div class="actionButtons">
            <s:button id="addisemir"
                   value="Add isemir"
                    view="/IsemirEdit.xhtml"
             propagation="none">
                 <f:param name="firmaId"
                         value="#{firmaHome.instance.id}"/>
                 <f:param name="isemirFrom" value="Firma"/>
            </s:button>
        </div>
        </f:subview>
    </rich:tab>

    <rich:tab label="Kalips">
        <h:form styleClass="association" id="kalipsChildren">

            <h:outputText value="There are no kalips associated with this firma."
                       rendered="#{empty firmaHome.kalips}"/>

            <rich:dataTable value="#{firmaHome.kalips}"
                           var="_kalip"
                      rendered="#{not empty firmaHome.kalips}"
                    rowClasses="rvgRowOne,rvgRowTwo"
                            id="kalipsTable">
                <rich:column sortBy="#{_kalip.id}">
                    <f:facet name="header">Id</f:facet>
                    <h:outputText value="#{_kalip.id}"/>
                </rich:column>
                <rich:column sortBy="#{_kalip.ad}">
                    <f:facet name="header">Ad</f:facet>
                    <h:outputText value="#{_kalip.ad}"/>
                </rich:column>
                <rich:column sortBy="#{_kalip.agirlik}">
                    <f:facet name="header">Agirlik</f:facet>
                    <h:outputText value="#{_kalip.agirlik}"/>
                </rich:column>
                <rich:column sortBy="#{_kalip.kod}">
                    <f:facet name="header">Kod</f:facet>
                    <h:outputText value="#{_kalip.kod}"/>
                </rich:column>
                <rich:column sortBy="#{_kalip.setmi}">
                    <f:facet name="header">Setmi</f:facet>
                    <h:outputText value="#{_kalip.setmi}"/>
                </rich:column>
            </rich:dataTable>

        </h:form>

        <f:subview rendered="#{firmaHome.managed}" id="kalips">
        <div class="actionButtons">
            <s:button id="addkalip"
                   value="Add kalip"
                    view="/KalipEdit.xhtml"
             propagation="none">
                 <f:param name="firmaId"
                         value="#{firmaHome.instance.id}"/>
                 <f:param name="kalipFrom" value="Firma"/>
            </s:button>
        </div>
        </f:subview>
    </rich:tab>

    <rich:tab label="Kullanicis">
        <h:form styleClass="association" id="kullanicisChildren">

            <h:outputText value="There are no kullanicis associated with this firma."
                       rendered="#{empty firmaHome.kullanicis}"/>

            <rich:dataTable value="#{firmaHome.kullanicis}"
                           var="_kullanici"
                      rendered="#{not empty firmaHome.kullanicis}"
                    rowClasses="rvgRowOne,rvgRowTwo"
                            id="kullanicisTable">
                <rich:column sortBy="#{_kullanici.id}">
                    <f:facet name="header">Id</f:facet>
                    <h:outputText value="#{_kullanici.id}"/>
                </rich:column>
                <rich:column sortBy="#{_kullanici.ad}">
                    <f:facet name="header">Ad</f:facet>
                    <h:outputText value="#{_kullanici.ad}"/>
                </rich:column>
                <rich:column sortBy="#{_kullanici.kod}">
                    <f:facet name="header">Kod</f:facet>
                    <h:outputText value="#{_kullanici.kod}"/>
                </rich:column>
                <rich:column sortBy="#{_kullanici.parola}">
                    <f:facet name="header">Parola</f:facet>
                    <h:outputText value="#{_kullanici.parola}"/>
                </rich:column>
            </rich:dataTable>

        </h:form>

        <f:subview rendered="#{firmaHome.managed}" id="kullanicis">
        <div class="actionButtons">
            <s:button id="addkullanici"
                   value="Add kullanici"
                    view="/KullaniciEdit.xhtml"
             propagation="none">
                 <f:param name="firmaId"
                         value="#{firmaHome.instance.id}"/>
                 <f:param name="kullaniciFrom" value="Firma"/>
            </s:button>
        </div>
        </f:subview>
    </rich:tab>

    <rich:tab label="Malzemes">
        <h:form styleClass="association" id="malzemesChildren">

            <h:outputText value="There are no malzemes associated with this firma."
                       rendered="#{empty firmaHome.malzemes}"/>

            <rich:dataTable value="#{firmaHome.malzemes}"
                           var="_malzeme"
                      rendered="#{not empty firmaHome.malzemes}"
                    rowClasses="rvgRowOne,rvgRowTwo"
                            id="malzemesTable">
                <rich:column sortBy="#{_malzeme.id}">
                    <f:facet name="header">Id</f:facet>
                    <h:outputText value="#{_malzeme.id}"/>
                </rich:column>
                <rich:column sortBy="#{_malzeme.ad}">
                    <f:facet name="header">Ad</f:facet>
                    <h:outputText value="#{_malzeme.ad}"/>
                </rich:column>
                <rich:column sortBy="#{_malzeme.barkod}">
                    <f:facet name="header">Barkod</f:facet>
                    <h:outputText value="#{_malzeme.barkod}"/>
                </rich:column>
                <rich:column sortBy="#{_malzeme.kod}">
                    <f:facet name="header">Kod</f:facet>
                    <h:outputText value="#{_malzeme.kod}"/>
                </rich:column>
            </rich:dataTable>

        </h:form>

        <f:subview rendered="#{firmaHome.managed}" id="malzemes">
        <div class="actionButtons">
            <s:button id="addmalzeme"
                   value="Add malzeme"
                    view="/MalzemeEdit.xhtml"
             propagation="none">
                 <f:param name="firmaId"
                         value="#{firmaHome.instance.id}"/>
                 <f:param name="malzemeFrom" value="Firma"/>
            </s:button>
        </div>
        </f:subview>
    </rich:tab>

    <rich:tab label="Rols">
        <h:form styleClass="association" id="rolsChildren">

            <h:outputText value="There are no rols associated with this firma."
                       rendered="#{empty firmaHome.rols}"/>

            <rich:dataTable value="#{firmaHome.rols}"
                           var="_rol"
                      rendered="#{not empty firmaHome.rols}"
                    rowClasses="rvgRowOne,rvgRowTwo"
                            id="rolsTable">
                <rich:column sortBy="#{_rol.id}">
                    <f:facet name="header">Id</f:facet>
                    <h:outputText value="#{_rol.id}"/>
                </rich:column>
                <rich:column sortBy="#{_rol.ad}">
                    <f:facet name="header">Ad</f:facet>
                    <h:outputText value="#{_rol.ad}"/>
                </rich:column>
                <rich:column sortBy="#{_rol.kod}">
                    <f:facet name="header">Kod</f:facet>
                    <h:outputText value="#{_rol.kod}"/>
                </rich:column>
            </rich:dataTable>

        </h:form>

        <f:subview rendered="#{firmaHome.managed}" id="rols">
        <div class="actionButtons">
            <s:button id="addrol"
                   value="Add rol"
                    view="/RolEdit.xhtml"
             propagation="none">
                 <f:param name="firmaId"
                         value="#{firmaHome.instance.id}"/>
                 <f:param name="rolFrom" value="Firma"/>
            </s:button>
        </div>
        </f:subview>
    </rich:tab>

    <rich:tab label="Uruns">
        <h:form styleClass="association" id="urunsChildren">

            <h:outputText value="There are no uruns associated with this firma."
                       rendered="#{empty firmaHome.uruns}"/>

            <rich:dataTable value="#{firmaHome.uruns}"
                           var="_urun"
                      rendered="#{not empty firmaHome.uruns}"
                    rowClasses="rvgRowOne,rvgRowTwo"
                            id="urunsTable">
                <rich:column sortBy="#{_urun.id}">
                    <f:facet name="header">Id</f:facet>
                    <h:outputText value="#{_urun.id}"/>
                </rich:column>
                <rich:column sortBy="#{_urun.adi}">
                    <f:facet name="header">Adi</f:facet>
                    <h:outputText value="#{_urun.adi}"/>
                </rich:column>
                <rich:column sortBy="#{_urun.ambalaj}">
                    <f:facet name="header">Ambalaj</f:facet>
                    <h:outputText value="#{_urun.ambalaj}"/>
                </rich:column>
                <rich:column sortBy="#{_urun.barkod}">
                    <f:facet name="header">Barkod</f:facet>
                    <h:outputText value="#{_urun.barkod}"/>
                </rich:column>
                <rich:column sortBy="#{_urun.paletadedi}">
                    <f:facet name="header">Paletadedi</f:facet>
                    <h:outputText value="#{_urun.paletadedi}"/>
                </rich:column>
                <rich:column sortBy="#{_urun.upc}">
                    <f:facet name="header">Upc</f:facet>
                    <h:outputText value="#{_urun.upc}"/>
                </rich:column>
                <rich:column sortBy="#{_urun.urunno}">
                    <f:facet name="header">Urunno</f:facet>
                    <h:outputText value="#{_urun.urunno}"/>
                </rich:column>
            </rich:dataTable>

        </h:form>

        <f:subview rendered="#{firmaHome.managed}" id="uruns">
        <div class="actionButtons">
            <s:button id="addurun"
                   value="Add urun"
                    view="/UrunEdit.xhtml"
             propagation="none">
                 <f:param name="firmaId"
                         value="#{firmaHome.instance.id}"/>
                 <f:param name="urunFrom" value="Firma"/>
            </s:button>
        </div>
        </f:subview>
    </rich:tab>
</rich:tabPanel>
</ui:define>

</ui:composition>
